/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>
#include <vector>
using namespace std;
bool isDraffodil(int num)
{
    int hundreds_digit=num/100;
    int tens_digit=(num/10)%10;
    int ones_digit=num%10;
    return (hundreds_digit*hundreds_digit*hundreds_digit+tens_digit*tens_digit*tens_digit+ones_digit*ones_digit*ones_digit)==num;
}
int main_81()
{
    int a,b;
    vector<int> draffodilVector;
    scanf("%d%d",&a,&b);
    for (int i=a;i<=b ;++i )
    {
        if (isDraffodil(i))
        {
            draffodilVector.push_back(i);
        }
    }
    if (draffodilVector.empty())
    {
        printf("NO\n");
    }
    else
    {
        auto oneBeforeEndIter=--draffodilVector.end();
        for (auto iter=draffodilVector.begin();iter!=oneBeforeEndIter ;++iter )
        {
            printf("%d ",*iter);
        }
        printf("%d",*oneBeforeEndIter);
    }
	return 0;
}
